package com.huchao.www.job;

import com.huchao.www.dao.LoginLogMapper;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @Description:
 * @BelongsProject: background-management-v10
 * @BelongsPackage: com.huchao.www.job
 * @Author: 亖思
 * @CreateTime: 2023/3/22 18:38
 * @Version: 1.0
 */
@DisallowConcurrentExecution
@PersistJobDataAfterExecution
@Component
public class UpdateLogJob implements Job {

    @Autowired
    private LoginLogMapper logMapper;

    /**
     * @param jobExecutionContext
     * @throws JobExecutionException
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        LocalDateTime ddl = LocalDateTime.now().minusMonths(1);
        if(logMapper.updateLogInfo(ddl)){
            System.out.println("记录清除完毕");
        }
    }
}
